package leetcode.code1817;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int[] findingUsersActiveMinutes(int[][] logs, int k) {
		Map<Integer, Set<Integer>> cnts = new HashMap<>();
		for (int i = 0; i < logs.length; i++) {
			int[] log = logs[i];
			int id = log[0], time = log[1];
			Set<Integer> set = cnts.getOrDefault(id, new HashSet<>());
			if (!set.contains(time)) {
				set.add(time);
			}
			cnts.put(id, set);
		}
		int[] ans = new int[k];
		for (Set<Integer> set : cnts.values()) {
			if (set.size() <= k) {
				ans[set.size() - 1]++;
			}
		}
		return ans;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
